package create.factoty;

/**
 * @author houkai
 */
public class AnimalFactory {
	
	public static Animal getAnimal(String name){
		Animal animal = null;
		 switch(name){
		 	case "dog":
		 		animal = new Dog();
		 		break;
		 	case "cat":
		 		animal = new Cat();
		 		break;
		 	default:
		 	    throw new RuntimeException("输入有误！");  
		 }
		return animal;
	}
}
